package io.zhengsh.vvip.leetcode.twopointer;

public class Q11_Container_With_Most_Water {

    static class Solution {
        public int maxArea(int[] height) {
            int i = 0, j = height.length - 1;
            int area = 0;
            while (i < j) {
                int a = Math.min(height[i], height[j]) * (j - i);
                area = Math.max(area, a);
                if (height[i] < height[j]) {
                    i++;
                } else {
                    j--;
                }
            }
            return area;
        }
    }
}
